diff options
| author | Adam Soltys <[email protected]> | 2023-03-28 22:45:44 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-03-28 22:45:44 -0700 |
| commit | 7da52f0ce5465262bbd809e979edd245668cd0b6 (patch) | |
| tree | efdabbb9d3ef917eae47f7f81aadad00c24ad11d /src/routes/(app)/[username]/invoice | |
| parent | 6b974d2ee7620f32233dac886922e98baa7502eb (diff) | |
| download | coinos-ui-7da52f0ce5465262bbd809e979edd245668cd0b6.tar.gz coinos-ui-7da52f0ce5465262bbd809e979edd245668cd0b6.zip | |
show user's currency
Diffstat (limited to 'src/routes/(app)/[username]/invoice')
| -rw-r--r-- | src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte index 9d9021a6..c0b504f8 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte @@ -56,7 +56,7 @@ export let data; $: refresh(data); - let { invoice, id, user } = data; + let { invoice, id, user, rates } = data; let { amount, hash, @@ -82,17 +82,19 @@ amount, hash, type, - rate, received, prompt, text, tip, - user: { username, currency } + user: { username } } = invoice); tipPercent = (tip / amount) * 100; }; + $: currency = user?.currency || invoice.currency; + $: rate = invoice.rate * (rates[currency] / rates[invoice.currency]); + $: tip = Math.round((amount / 100) * tipPercent); $: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2)); |
